package com.sean.gulimall.product.web;

import com.sean.gulimall.product.service.SkuInfoService;
import com.sean.gulimall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * TODO
 *
 * @author 59244
 * @date 2022/1/26 18:17
 */
@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String item(@PathVariable("skuId") Long skuId, Model model){
        System.out.println("商品"+skuId+"的信息");
        SkuItemVo skuItemVo = skuInfoService.item(skuId);

        model.addAttribute("item", skuItemVo);
        return "item";
    }
}
